import request from '@/utils/request';
import { getFormData } from '@/utils/Yvan';

export default {
    namespace: 'ComboModule',

    //状态
    state: {
        sys: []
    },

    // 异步方法
    effects: {
        //请求 system 的下拉框
        *sys({ payload }, { call, put }) {
            const r = () => request('/api/sys/system/queryCombo');
            const response = yield call(r, payload);
            yield put({
                type: 'save',
                payload: response,
            });
        },
    },

    // 同步方法
    reducers: {
        save(state, action) {
            if (action.payload.success) {
                return { sys: action.payload.data }
            }
            return {};
        },
    },
}